home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 May / CHIP Turkiye Mayıs 1998.iso / araclar / winamp182.exe / FRONTEND.TXT next >
Text File  |  1998-03-18  |  6KB  |  183 lines

  1. This file is only useful for people who are writing frontends for Winamp.
  2. Actually, it's useful for plugin authors too.
  3.  
  4.  
  5. There are some useful notes for VB programmers at the end of this file.
  6.  
  7.  
  8.  
  9. Psuedo IPC for frontends for Winamp v1.55+ (< 2.0)
  10.  
  11. This document is horribly [de]organized, and is pretty much just hacked
  12. together for people to use.
  13.  
  14. Winamp's window is found using:
  15. hwnd_winamp = FindWindow("Winamp v1.x",NULL);
  16.  
  17. #define WM_WA_IPC WM_USER
  18. // messages are sent to the winamp window using:
  19. result = SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
  20.  
  21.  
  22. /* Messages available to send */
  23.  
  24. #define IPC_GETVERSION 0
  25. /*
  26.     IPC_GETVERSION is sent to the window, and the return value is the version
  27.         Version 1.55 = 0x1551
  28.         Version 1.6b = 0x16A0
  29.         Version 1.60 = 0x16AF
  30.         Version 1.61 = 0x16B0
  31.         Version 1.62 = 0x16B1
  32.         Version 1.64 = 0x16B3
  33.         Version 1.666 = 0x16B4
  34.         Version 1.69 = 0x16B5
  35.         Version 1.70 = 0x1700
  36.         Version 1.72 = 0x1702
  37.         Version 1.73 = 0x1703
  38.         Version 1.80 = 0x1800
  39.         Version 1.81 = 0x1801
  40.         Version 1.82 = 0x1802
  41.     the command_data parameter is 0.
  42.     so, 
  43.     if (SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) != 0x1551)
  44.         MessageBox(NULL,"Error, Winamp 1.55 not found","Warning",MB_OK);
  45. */
  46.  
  47.  
  48. #define IPC_PLAYFILE 100
  49. /*
  50.     IPC_PLAYFILE is sent to the window for each char of a null terminated string of a file to ADD
  51.     to the playlist (it doesn't change the playing status). Note, if you pass a file with the extension
  52.     ".m3u" it will be treated as a playlist.
  53.     for example:
  54.         char *file = "C:\\download\\booga.mp3";
  55.         int x;
  56.         for (x = 0; x <= strlen(file); x ++)
  57.             PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)file[x],IPC_PLAYFILE);
  58.     will add "C:\download\booga.mp3" to the end of the playlist
  59. */
  60.  
  61. #define IPC_DELETE 101
  62. /* 
  63.     IPC_DELETE deletes the internal Winamp playlist.
  64.         SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
  65. */
  66.  
  67. #define IPC_STARTPLAY 102
  68. /* 
  69.     IPC_STARTPLAY starts the playing.
  70.         SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
  71. */
  72.  
  73. #define IPC_CHDIR 103
  74. /*
  75.     IPC_CHDIR is sent to the window for each char of a null terminated string of a directory to change to
  76.     for example:
  77.         char *dir = "C:\\Download";
  78.         int x;
  79.         for (x = 0; x <= strlen(file); x ++)
  80.             PostMessage(hwnd_winamp,WM_WA_IPC,(LPARAM)dir[x],IPC_PLAYFILE);
  81.     will change the winamp process to "C:\download" (useful for relative pathnames and loading playlists)
  82.  
  83. */
  84. #define IPC_ISPLAYING 104
  85. /*
  86.     IPC_ISPLAYING returns the status of playback.
  87.     If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing.
  88.     If it returns something other than 1,3,or 0, something is screwed.
  89.     isplaying = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
  90. */
  91.  
  92.  
  93. #define IPC_GETOUTPUTTIME 105
  94. /*
  95.     IPC_GETOUTPUTTIME returns the position in milliseconds of the 
  96.           current song (lParam = 0), or the song length, in seconds (lParam = 1).
  97.     Returns -1 if not playing or error.
  98.         
  99.     song_pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME);
  100.     song_len = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETOUTPUTTIME);
  101. */
  102.  
  103. #define IPC_JUMPTOTIME 106
  104. /*
  105.         *ONLY AVAILABLE IN v1.60+*
  106.     IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately)
  107.     Returns -1 if not playing, 1 on eof, or 0 if successful
  108.     SendMessage(hwnd_winamp,WM_WA_IPC,new_song_pos,IPC_JUMPTOTIME);
  109. */
  110. #define IPC_WRITEPLAYLIST 120
  111. /*
  112.         *ONLY AVAILABLE IN v1.666+*
  113.     IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.pl
  114.     int cursong =  SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
  115.     (cursong is the index of the current song in the playlist)
  116. */
  117.  
  118.  
  119. // THESE MIGHT CHANGE in the future :)
  120. //Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including
  121. // Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);
  122.  
  123. // toggles the EQ window
  124. #define WINAMP_OPTIONS_EQ               40036
  125. // toggles the playlist window
  126. #define WINAMP_OPTIONS_PLEDIT           40040
  127. // turns the volume up a little
  128. #define WINAMP_VOLUMEUP                 40058
  129. // turns the volume down a little
  130. #define WINAMP_VOLUMEDOWN               40059
  131. // fast forwards 5 seconds
  132. #define WINAMP_FFWD5S                   40060
  133. // rewinds 5 seconds
  134. #define WINAMP_REW5S                    40061
  135. // the following are the five main control buttons, with optionally shift or control pressed
  136. // (for the exact functions of each, just try it out)
  137. #define WINAMP_BUTTON1                  40044
  138. #define WINAMP_BUTTON2                  40045
  139. #define WINAMP_BUTTON3                  40046
  140. #define WINAMP_BUTTON4                  40047
  141. #define WINAMP_BUTTON5                  40048
  142. #define WINAMP_BUTTON1_SHIFT            40144
  143. #define WINAMP_BUTTON2_SHIFT            40145
  144. #define WINAMP_BUTTON3_SHIFT            40146
  145. #define WINAMP_BUTTON4_SHIFT            40147
  146. #define WINAMP_BUTTON5_SHIFT            40148
  147. #define WINAMP_BUTTON1_CTRL             40154
  148. #define WINAMP_BUTTON2_CTRL             40155
  149. #define WINAMP_BUTTON3_CTRL             40156
  150. #define WINAMP_BUTTON4_CTRL             40157
  151. #define WINAMP_BUTTON5_CTRL             40158
  152.  
  153. // always goes to the previous song (unlike button 1), 1.666+
  154. #define WINAMP_PREVSONG                    40198
  155.  
  156. // pops up the load file(s) box
  157. #define WINAMP_FILE_PLAY                40029
  158. // pops up the preferences
  159. #define WINAMP_OPTIONS_PREFS            40012
  160. // toggles always on top
  161. #define WINAMP_OPTIONS_AOT              40019
  162. // pops up the about box :)
  163. #define WINAMP_HELP_ABOUT               40041
  164.  
  165.  
  166. /* A little about Visual Basic
  167. In VB, the SendMessage function does not work, you must use the SendMessageTimeout. 
  168. Otherwise, VB will not wait for WinAmp to return a value. Here's an example...
  169.     Dim Success as Long
  170.     Dim ReturnValue As Long
  171.     Success = SendMessageTimeout(WinampHandle, WM_USER, 0, 104, SMTO_BLOCK, 1000, ReturnValue)
  172.     MsgBox (ReturnValue)
  173. If you are sending commands, use this format;
  174.     Dim Success as Long
  175.     Success = PostMessage(WinampHandle, WM_COMMAND, 40022, 0)
  176. // -VB notes by Amal G.
  177. */
  178.  
  179.  
  180.  
  181. // hope this helps, 
  182. // -Justin [justin@nullsoft.com]
  183.